package Threads.ReentrantLock.fixed_sequence;

import java.util.concurrent.locks.LockSupport;

public class park_unpark {
    public static void main(String[] args) {
        Thread t1=new Thread(()->{
            //没有许可，线程会暂停
            LockSupport.park();
            System.out.println("t1");
        });

        Thread t2=new Thread(()->{
            System.out.println("t2");
            //给t1线程发放许可，让t1运行
            LockSupport.unpark(t1);
        });

        t1.start();
        t2.start();
    }
}
